// --------------------------------------------------------------------------------------------------------------------
// <copyright file="SqlAzureDatabaseEditionCapacityInfoTest.cs" company="">
//   
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace Tests
{
    using System;

    using ExecutionTool.CopyDatabase;

    using Microsoft.VisualStudio.TestTools.UnitTesting;

    [TestClass]
    public class SqlAzureDatabaseEditionCapacityInfoTest
    {
        #region Public Methods and Operators

        [TestMethod]
        public void CanInstantiateFromMixedTypedValue()
        {
            var info = new SqlAzureDatabaseInfo("Web", (long)5 * 1024 * 1024 * 1024, 512);

            Assert.AreEqual(SqlAzureDatabaseEdtion.Web, info.Edition);
            Assert.AreEqual(5, info.MaxSizeInGb);
        }

        [TestMethod]
        public void CanInstantiateFromStrongTypedValue()
        {
            var info = new SqlAzureDatabaseInfo(SqlAzureDatabaseEdtion.Web, (long)5 * 1024 * 1024 * 1024);

            Assert.AreEqual(SqlAzureDatabaseEdtion.Web, info.Edition);
            Assert.AreEqual(5, info.MaxSizeInGb);
        }

        [TestMethod]
        public void CanInstantiateFromTextValue()
        {
            var info = new SqlAzureDatabaseInfo("Web", "5GB");

            Assert.AreEqual(SqlAzureDatabaseEdtion.Web, info.Edition);
            Assert.AreEqual(5, info.MaxSizeInGb);
        }

        [ExpectedException(typeof(ArgumentException))]
        [TestMethod]
        public void CannotInstantiateFromInvalidStrongTypedValue()
        {
            var info = new SqlAzureDatabaseInfo(SqlAzureDatabaseEdtion.Web, (long)5 * 1024 * 1024 * 1000);
        }

        [ExpectedException(typeof(ArgumentException))]
        [TestMethod]
        public void CannotInstantiateFromInvalidTextValue()
        {
            var info = new SqlAzureDatabaseInfo("InvalidEdtion", "5GB");
        }

        #endregion
    }
}
